package cn.gyx.hrm.web.controller;

import cn.gyx.hrm.doc.CourseDoc;
import cn.gyx.hrm.doc.dto.CourseSearchDto;
import cn.gyx.hrm.service.ICourseESService;
import cn.gyx.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course")
public class CourseESController {

    @Autowired
    private ICourseESService courseESService;

    /**
     * 收索
     * @param
     * @return
     */
    @PostMapping("/search")
    public AjaxResult searchES(@RequestBody CourseSearchDto dto) {
        return AjaxResult.me().setResultObj(courseESService.search(dto));
    }
    //  添加
    @PostMapping("/save")
    public AjaxResult saveed(@RequestBody CourseDoc course){
        courseESService.save(course);
        return AjaxResult.me();
    }
}
